import Mock from 'mockjs'

const count = 9
const ClassList = []

const baseContent = '@cparagraph'
const image_uri = '@image'

for(let i=0; i<count; i++){
  ClassList.push(Mock.mock({
    classID:'@string(lower,6)',
    className:'@ctitle(3, 5)',
    teacher:'@cname',
    'status|1': ['running', 'stoped', 'hangup'],
    screen: image_uri,
    detail: {
      ip_adr: '@ip',
      username: 'root',
      psw:'123456',
      'osType|1': ['Linux', 'Window7'],
      deadline: '@date',
      info: baseContent,
    },
  }))
}
// console.log(ClassList)


export default [
  {
    url: '/student/list',
    type: 'get',
    response: config => {
      const { stuID, classID, className} = config.query

      let mockList = ClassList.filter(item => {
        if (classID && item.classID.indexOf(classID) < 0) return false
        if (className && item.className.indexOf(className) < 0) return false
        return true
      })

      return {
        code: 20000,
        data: {
          total: mockList.length,
          list: mockList
        }
      }
    }
  },
]